/*
 * @Description: 
 * @version: 
 * @Author: cy
 * @Date: 2022-05-05 11:43:56
 * @LastEditors: cy
 * @LastEditTime: 2022-05-05 15:17:22
 */
/***
 * LeetCode 349 
 */
var intersection = function (nums1, nums2) {
    const map = new Map();
    nums1.forEach(n => {
        map.set(n, true);
    })
    const res = [];
    nums2.forEach(n => {
        if (map.get(n)) {
            res.push(n);
            map.delete(n);
        }
    })
    return res;
}
intersection([4,9,5], [9,4,9,8,4])
